﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 创建者模式
{
    public class MilkTea
    {
        public MilkTea() { }
        private string Type;
        private string Pearl;
        private int Size;
        private string Ice;

        public override string ToString()
        {
            return $"milkTea:Type:{Type},Pearl:{Pearl},Size：{Size}，Ice：{Ice}";
        }

        public class MilkBuilder
        {
            private readonly MilkTea MilkTea;
            public MilkBuilder()
            {
                MilkTea = new MilkTea();
            }

            public MilkBuilder SetType(string type)
            {
                MilkTea.Type = type;
                return this;
             }

            public MilkBuilder SetPearl(string pearl)
            {
                MilkTea.Pearl = pearl;
                return this;
            }

            public MilkBuilder SetIce(string ice)
            {
                MilkTea.Ice = ice;
                return this;
            }

            public MilkBuilder SetSize(int size)
            {
                MilkTea.Size = size;
                return this;
            }

            public MilkTea Build()
            {
                return MilkTea;
            }
        }
    }

    
}
